package com.nowcoder.community.entity;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * @author cjh
 * @date 2022/12/30 - 11:49
 */
public class PageEntity {
    private long current = 1L;
    private long size = 10L;

    public PageEntity() {
    }

    public PageEntity(long current, long size) {
        this.current = current;
        this.size = size;
    }

//    public long getFrom() {
//        long from = current - 2;
//        return from < 1 ? 1 : from;
//    }
//
//    public long getTo(){
//        long from = current - 2;
//        return from < 1 ? 1 : from;
//    }

    public long getCurrent() {
        return this.current;
    }

    public void setCurrent(long current) {
        this.current = current;
    }

    public long getSize() {
        return this.size;
    }

    public void setSize(long size) {
        this.size = size;
    }

    public <T> Page<T> toPage() {
        return new Page(this.current, this.size);
    }

    public <T> Page<T> toPage(Class<T> clazz) {
        return new Page(this.current, this.size);
    }

    public String toString() {
        return "PageEntity{current=" + this.current + ", size=" + this.size + '}';
    }
}
